package defiant.common.tools;

import java.util.Properties;

public final class SysProperties {
	
	private SysProperties() {
		// util 
	}
	
	static {
		
		// load default just in case 
		DEBUG = false;
		APPLICATION_TITLE = "Defiant X";
		START_PAGE = "http://localhost:8888/";
		//START_PAGE = "https://110.5.66.222:8082/login.do?jsessionid=bb789812fc2378c9f7fedb2abbc837d1";
		BROWSER_ICON = "images/1255838580_browser.png";
		WEB_SERVER_PORT = 8888;
		
		try {
			Properties props = ResourceUtil.loadProperties("resources.sys");
			
			String debug = props.getProperty("debug");
			if ("true".equals(debug)) DEBUG = true;
			
			String title = props.getProperty("application.title");
			if (title != null) APPLICATION_TITLE = title;
			
			String startPage = props.getProperty("start.page");
			if (startPage != null) START_PAGE = startPage;
			
			String icon = props.getProperty("browser.icon");
			if (icon != null) BROWSER_ICON = icon;
			
			String port = props.getProperty("webserver.port");
			if (port != null) WEB_SERVER_PORT = Integer.parseInt(port);
			
		} catch (Exception e) {
			e.printStackTrace(System.err);
		}
	}
	
	public static Boolean DEBUG; // = false;
	public static String APPLICATION_TITLE;
	public static String START_PAGE;
	public static String BROWSER_ICON;
	public static int WEB_SERVER_PORT;
	
	public static void initialize() {
//		Properties props = new Properties();
//		props.put("java.home", "C:/Program Files/Java/jdk1.6.0_16");
//		System.getProperties().putAll(props);
		
		// so static will be called
	}
}
